<?php

namespace App\Http\Controllers\Admin;

use App\Repository\AdminUserRepository;
use App\Repository\Commit\RoleRepository;
use App\Repository\SystemRepository;
use App\Repository\Commit\PositionRepository;
use Illuminate\Http\Request;

/**
 * @OA\Tag(
 *     name="后台菜单模块",
 *     description="菜单模块",
 * )
 */
class AdminUserController extends BaseController
{
  public function __construct(AdminUserRepository $AdminUserRepository, SystemRepository $SystemRepository, RoleRepository $RoleRepository, PositionRepository $PositionRepository)
  {
    $this->repoist = $AdminUserRepository;
    $this->system = $SystemRepository;
    $this->role = $RoleRepository;
    $this->position = $PositionRepository;
  }
  public function index(Request $Request)
  {
    $data = $this->repoist->index($Request);
    return $data;
  }
  public function noInList(Request $Request)
  {
    $data = $this->repoist->noInList($Request);
    return $data;
  }
  public function onSel()
  {
  }
  public function store(Request $Request)
  {
    //用户添加

  }
  public function getUser(Request $Request)
  {
    // 返回数据
    $return = [
      'code' => 200,
      'msg' => '操作成功',
      'roles' => $this->role->getAllData(), // 角色
      'positions' => $this->position->getAllData(), // 部门
    ];
    $msg = '操作成功';
    if (empty($return['roles'])) {
      $return['code'] = -1;
      $msg = '未查询到角色 请前去添加角色';
    }
    if (empty($return['positions'])) {
      $return['code'] = -1;
      $msg = '未查询到部门 请前去添加部门';
    }
    $return['msg'] = $msg;
    return $return;
  }
}
